﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ElectronicRecords.Models
{
    public class DataManager
    {



        private ElectronicRecordsDataContext _datacontext;

        public DataManager(string connectionString)
        {
            _datacontext = new ElectronicRecordsDataContext(connectionString);
        }

        private ClientsRepository _clientsRepository;
        public ClientsRepository Clients
        {
            get
            {
                if (_clientsRepository == null)
                    _clientsRepository = new ClientsRepository(_datacontext);
                return _clientsRepository;
            }
        }

        private ProcedursRepository _procedursRepository;
        public ProcedursRepository Procedurs
        {
            get
            {
                if (_procedursRepository == null)
                    _procedursRepository = new ProcedursRepository(_datacontext);
                return _procedursRepository;
            }
        }

        private UserRepository _userRepository;
        public UserRepository Users
        {
            get
            {
                if (_userRepository == null)
                    _userRepository = new UserRepository();
                return _userRepository;
            }
        }

        private EquipmentsRepository _equipmentsRepository;
        public EquipmentsRepository Equipments
        {
            get
            {
                if (_equipmentsRepository == null)
                    _equipmentsRepository = new EquipmentsRepository(_datacontext);
                return _equipmentsRepository;
            }
        }

        private SpecialistsRepository _specialistsRepository;
        public SpecialistsRepository Specialists
        {
            get
            {
                if (_specialistsRepository == null)
                    _specialistsRepository = new SpecialistsRepository(_datacontext);
                return _specialistsRepository;
            }
        }

        private RequestsRepository _requestsRepository;
        public RequestsRepository Requests
        {
            get
            {
                if (_requestsRepository == null)
                    _requestsRepository = new RequestsRepository(_datacontext);
                return _requestsRepository;
            }
        }


    }
}